<%@page import="java.util.Iterator"%>
<%@page import="user.User"%>
<%@page import="java.util.ArrayList"%>
<%@page import="user.UserDao"%>
<%@page import="common.DBUtil,java.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
    a{
     text-decoration: none
  }
  </style>
  <script type="text/javascript">
function reallyDel(uuu){
	var hint="确认要删除用户:"+uuu+"？";
	var jg=confirm(hint);
	if(jg){
		return true;
	}
	return false;
}
</script>
<script type="text/javascript">
function reallyRes(uuu){
	var hint="确认重置密码";
	var jg=confirm(hint);
	if(jg){
		return true;
	}
	return false;
}
</script>
<script type="text/javascript">
function reallyPow(uuu){
	var hint="确认修改权限";
	var jg=confirm(hint);
	if(jg){
		return true;
	}
	return false;
}
</script>
<script type="text/javascript">
function reallySta(uuu){
	var hint="确认修改状态";
	var jg=confirm(hint);
	if(jg){
		return true;
	}
	return false;
}
 </script>
</head>
<body>
<!-- 个人查询的界面 -->
<table border="1" align="center"  width="80%" cellspacing="1" cellpading="1" >
<tr>
<td>编号</td>
<td>用户名</td>
<td>性别</td>
<td>职业</td>
<td>爱好</td>
<td>类型</td>
<td>状态</td>
<td>重置密码</td>
<td>修改权限</td>
<td>更改状态</td>
<td>删除用户</td>
<%
String uname=request.getParameter("uname");
UserDao dao = new UserDao();
ArrayList<User> list = dao.doSelectByUname(uname);
Iterator<User> it = list.iterator();
while(it.hasNext()){
	
	User user = it.next();
	int uid = user.getUid();
	String sex = user.getSex();
	if(sex.equals("1")){
		sex="女";
	}
	else{
		sex="男";
	}
	int type =user.getType();
	String type_s;
	if(type == 0){
		type_s="普通用户";
	}
	else{
		type_s="管理员";
	}
	int isValid =user.getIsValid();
	String isValid_s;
	if(isValid == 0){
		isValid_s="无效";
	}
	else{
		isValid_s="有效";
	}
	
	%>
<tr>
<td><%=uid %></td>
<td><%=user.getUname() %></td>
<td><%=sex %></td>
<td><%=user.getProfession() %></td>
<td><%=user.getFavourite() %></td>
<td><%=type_s %></td>
<td><%=isValid_s%></td>
<td><a href="../User_pass_reset?uid=<%=uid%>" onclick="return reallyRes()">重置密码</a></td>
<td><a href="../User_power_update?uid=<%=uid%>" onclick="return reallyPow()">修改权限</a></td>
<td><a href="../User_stata_update?uid=<%=uid%>" onclick="return reallySta()">更改状态</a></td>
<td><a href="../User_deleteServlet?uid=<%=uid%>" onclick="return reallyDel()">删除</a></td>
<td><a href="./userModify.jsp?uid=<%=uid%>&uname=<%=user.getUname() %>&note=<%=user.getNote() %>" onclick="return reallyUPD()">修改</a></td>

<% 
	}
%>
</body>
</html>